conf = require("../config")
if not conf.evergarden.enabled then return {} end

return {
  'everviolet/nvim', name = 'evergarden',
  priority = 1000, -- Colorscheme plugin is loaded first before any other plugins
  opts = {
    theme = {
      variant = 'spring', -- 'winter'|'fall'|'spring'|'summer'
      accent = 'green',
    },
    editor = {
      transparent_background = true,
      sign = { color = 'none' },
      float = {
        color = 'mantle',
        invert_border = true,
      },
      completion = {
        color = 'surface0',
      },
    },
  },
  config = function (_, opts)

    require("evergarden").setup(opts)

    local function evergarden_custom()
      if opts.editor.transparent_background == true then
        vim.api.nvim_set_hl(0, 'NormalFloat', { bg = "none" })
        vim.api.nvim_set_hl(0, 'FloatBorder', { bg = "none" })
        vim.api.nvim_set_hl(0, 'Pmenu', { bg = "none" })
      end
    end

    vim.api.nvim_create_autocmd("ColorScheme", {
      pattern = "evergarden",
      callback = evergarden_custom
    })
  end
}
